package com.woniu;

import com.woniu.Result;
import com.woniu.dto.OrderDto;
import com.woniu.dto.OrderPayDto;
import com.woniu.pojo.Order;
import com.woniu.pojo.OrderItem;
import com.woniu.vo.OrderQueryVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@FeignClient(value = "order-service",path = "/order")
public interface OrderFeignClient {

    @ApiOperation("通过userId查找所有订单")
    @GetMapping("user/{userId}")
    public Result<List<Order>> getByUserId(@PathVariable("userId") Integer userId);

    @ApiOperation("通过id查找shopId")
    @GetMapping("/shop/{id}")
    public Result<Integer> getShopId(@PathVariable("id") Integer id);


    @PostMapping
    public Result<String> createOrder(@RequestBody OrderDto orderDto);

    @GetMapping("{orderSn}")
    public Result<OrderQueryVo> findOrderByOrderSn(@PathVariable("orderSn") String orderSn);

    @PutMapping
    public Result<String> updateOrderStatus(@RequestBody OrderPayDto orderPayDto);

    @PutMapping("/updateStatus/{orderSn}")
    public Result<String> updateStatus(@PathVariable("orderSn") String orderSn);

    @PutMapping("/updateStatusPro/{orderSn}")
    public Result<String> updateStatusPro(@PathVariable("orderSn") String orderSn);

}
